class Solution {
public:
    static bool cmp(int x,int y){
        string s1 = to_string(x);
        string s2 = to_string(y);
        string m = s1 + s2;
        string n = s2 + s1;
        
        return m > n;
    }
    string largestNumber(vector<int>& nums) {
        sort(nums.begin(),nums.end(),cmp);
        string ret;
        for(int i = 0;i < nums.size();i++){
            ret += to_string(nums[i]);
        }
        int i = 0;
        for(i = 0;i < ret.size();i++){
            if(ret[i] != '0'){
                break;
            }
        }
        if(i == ret.size()) return "0";
        return string(ret.begin()+i,ret.end());
    }
};
